#pragma once
#include "gridctrl\gridctrl.h"
#include "afxwin.h"

#include "resource.h"
// CDlgTemplate dialog

class CDlgTemplate : public CDialogEx
{
	DECLARE_DYNAMIC(CDlgTemplate)

public:
	CDlgTemplate(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgTemplate();

// Dialog Data
	enum { IDD = IDD_DLG_TEMPLATE };

public:
	CToolBar	m_wndToolBar;
	CStatusBar	m_wndStatusBar;

	CPixLedCtrl m_PixLedCtrl;  

	int m_nRows;
	int m_nCols;

	int m_nFixRows;
	int m_nFixCols;

	int m_nCurCol;
	int m_nCurRow;

	CXML     m_Xml;
public:
	BOOL CreateBars();
	void InitCtrlPos();
	void InitGrid();

	void SaveGridWidth();
	void SetGridTxt(int nLed_Type, int nPage_ID);

	void UpdateGridPreview();

	void LoadGrid(char* pszFileName);
	void SaveGrid(char* pszFileName);

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	//GVN_SELCHANGED
	afx_msg void OnGridCellChangeNotify(NMHDR *nmhdr, LRESULT *result); 
	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
	CGridCtrl m_Grid;
	CComboBox m_cmbLed_Type;
	CColorPicker m_btnLine_Color;
	afx_msg void OnTbGropen();
	afx_msg void OnTbGrsave();
	afx_msg void OnTbGrmergeCell();
	afx_msg void OnTbGrunmergeCell();
	afx_msg void OnTbGrcolIncrease();
	afx_msg void OnTbGrcolDecrease();
	afx_msg void OnTbGrdeleteCol();
	afx_msg void OnTbGrdeleteRow();
	afx_msg void OnTbGraddCol();
	afx_msg void OnTbGraddRow();
	afx_msg void OnTbGralignLeft();
	afx_msg void OnTbGralignCenter();
	afx_msg void OnTbGralignRight();
	afx_msg void OnTbGrfont();
	afx_msg void OnTbGrinitial();
	afx_msg void OnTbGrexit();
	afx_msg void OnTbGrlineColor();
	CComboBox m_cmbColumn;
//	afx_msg void OnBnClickedButtonGet();
	afx_msg void OnBnClickedButtonSet();
	afx_msg void OnSelchangeComboLedType();
	CComboBox m_cmbPage_ID;
	afx_msg void OnSelchangeComboPageId();
	CComboBox m_cmbFont_Size;
	afx_msg void OnSelchangeComboFontSize();
	CComboBox m_cmbFont_Width;
	afx_msg void OnSelchangeComboFontWidth();
	CComboBox m_cmbCol_Width;
	CColorPicker m_btnFont_Color;
	CComboBox m_cmbRow;
	afx_msg void OnBnClickedButtonFontColor();
	afx_msg void OnBnClickedButtonLineColor();
//	afx_msg void OnBnClickedButton2();
	afx_msg void OnBnClickedButtonSetFontSize();
};
